<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title></title>
</head>

<body>
    <script>
        document.write("<pre>赫尔普斯曾经提到过，\n 有时候读书是一种巧妙地避开思考的方法。</pre>");
        document.write('赫尔普斯曾经提到过，有时候读书是一种巧妙地避开思考的方法。')

        var html = `<div>有时候读书是一种巧妙地避开思考的方法。</div>`;
        document.write(html);

        var str = 'hello world!';
        console.log(str[0], str[11]);
        // 获取字符串最后一个字符
        console.log(str.charAt(str.length - 1));

        var a = 0b11; // 2进制转10进制
        console.log(a); //3

        var a = 0xff; // 16进制转10进制   先2进制再10进制  1111 1111   2^8 - 1
        console.log(a); // 255

        /* 
        10进制转2进制
            2  30   余数
            2   15   0
             2   7    1
             2   3   1
             2   1   1
             2    0   1
             
             2进制转10进制
             1011；
             1*2^3+0*2^2+1*2^1+1*2^0;
             8+0+2+1 = 11
             
             2进制转10进制
             0.101;
             1 * 2^-1 + 0 * 2^ -2 + 1 * 2 ^-3;
             0.5+0.125= 0.625; */

        console.log(0.1 + 0.2);

        var num = 1;
        var str = '1';
        console.log(num, str);

        var flag = true;
        console.log(flag.toString());


        var str = "";
        var num = "-10";
        var num1 = 0;
        var nu = undefined;
        var nu1 = "undefined";
        var nu1 = "null";
        var nu2 = null;
        var obj = "{}";
        var obj1 = {};

        console.log(Object.prototype.toString.call(str));
        console.log(Object.prototype.toString.call(num));
        console.log(Object.prototype.toString.call(num1));
        console.log(Object.prototype.toString.call(nu));
        console.log(Object.prototype.toString.call(nu1));
        console.log(Object.prototype.toString.call(nu1));
        console.log(Object.prototype.toString.call(nu2));
        console.log(Object.prototype.toString.call(obj));
        console.log(Object.prototype.toString.call(obj1))
    </script>
</body>

</html>